const baseUrl = "http://dev.woniulab.com:7689"
// const baseUrl = "http://192.168.13.23:10000"

function request ({url,method="GET",data}={}){
	uni.showLoading({
		title:'加载中'
	});
	return new Promise((resolve,reject)=>{
		uni.request({
			url:baseUrl+url,
			method,
			data,
			success:res=>{
				resolve(res.data)
			},
			fail(){
				uni.showToast({
					title:'网络错误',
					duration:2000,
				});
			},
			complete: () => {
				uni.hideLoading();
			}
		})
	})
}

export default request;